#ifndef VISBASECOLLECTION_H
#define VISBASECOLLECTION_H

#include <QGraphicsWidget>
#include <QPainter>
#include <QRect>
#include <QRectF>
#include <QStyleOptionGraphicsItem>
#include <QWidget>
#include <QPointer>
#include <QDebug>

//The base class for all 'collections'

//A collection consists of either a set of collections, or a set of elements
//It has as a parent either another collection or a visbasewidget

//Collections implement the following:
//  1) Movement
//      dynX, dynY, dynWidth, dynHeight - store values for the object's location and appearance
//      these values are DynamicValues that can be changed with the call 'target'
//      provided the collection is called on 'advance'
//      it will gradually move from the current value, to the targeted value on a function
//

class DynamicValue;

class VisBaseCollection : public QGraphicsWidget
{
    Q_OBJECT

public:
    VisBaseCollection(QGraphicsItem *parent = 0);
    ~VisBaseCollection();

    QRectF boundingRect() const;
    QPainterPath shape() const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
               QWidget *widget);

    void target( float x, float y );
    void setValues( float x, float y );
    bool isTargeting;

    DynamicValue* dynX;
    DynamicValue* dynY;
    DynamicValue* dynWidth;
    DynamicValue* dynHeight;

    QRectF centerXCenterYRect() const;
    QRectF centerXTopYRect() const;
    QRectF leftXCenterYRect() const;
    QRectF leftXTopYRect() const;

public slots:
        void advance();
};

#endif // VISBASECOLLECTION_H
